<!--父组件中引入子组件-->
<template>
  <div>
    <a href="javascript:;" @click="fromMutations()">点击mutations</a>
    <a href="javascript:;" @click="fromActions()">点击actions</a>
    <t-dialog></t-dialog>
  </div>
</template>

<script>
import dialog from '@/components/dialog.vue'
import { mapState, mapActions, mapMutations } from 'vuex'

export default {
  components: {
    't-dialog': dialog
  },
  computed: {
    ...mapState([
      'dialog'
    ])
  },
  methods: {
    ...mapMutations([
      'SWITCH_DIALOG'
    ]),
    ...mapActions([
      'switchDialog'
    ]),
    fromMutations: function () {
      this.SWITCH_DIALOG()
    },
    fromActions: function () {
      this.switchDialog()
    }
  }
}
</script>
